import {createApp} from 'vue'
import 'vue-global-api' // 解决vue3 composition api 在每个vue文件内重复调用问题
import App from './App'
import router from './router'
import store from './store'
import './index.css'
import './css/font.css'
import './css/animation.css'
import 'animate.css'
import './css/elementPlus.css'
import './css/iconfont.css'
import './css/iconfont1.css'
import './css/antDesignVue.less'
import './css/echarts.less'
import './css/tailwind.less'
import Vue from 'vue'
import BaiduMap from 'vue-baidu-map-3x'

import lazyPlugin from 'vue3-lazy'
import globalRegister from './libs/global/index'

import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import locale from 'element-plus/lib/locale/lang/zh-cn'
import {imagesUrl} from './libs/baseUrl'

import Antd from 'ant-design-vue'
import 'ant-design-vue/dist/antd.css'

const app = createApp(App)

app.use(lazyPlugin, {
  loading: imagesUrl('placeholder') //图片加载中时显示的默认图片
})

/**注册 */
app.use(globalRegister)
app.use(BaiduMap, {
  // ak 是在百度地图开发者平台申请的密钥 详见 http://lbsyun.baidu.com/apiconsole/key */
  ak: 'HkYrYcGatD4UPvbf2AQGOezjZ8KtddI4'
})
app.use(ElementPlus, {locale})
app.use(Antd)
app.use(store)
app.use(router)
app.mount('#app')

window.addEventListener('beforeunload', function (event) {
  // event.returnValue = true;  // chrome
  // clearStorage()
  // clearSession()
  // location.reload()
})
